<!DOCTYPE html>
<html>
    <head>
        <title>Goleek登录</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="IE=Edge;IE=11;IE=10">
        <meta name="renderer" content="webkit|ie-comp|ie-stand">

        <link rel="stylesheet" href="css/themes/default/easyui.css">        
        <link rel="stylesheet" href="css/themes/icon.css">
        <link rel="stylesheet" href="css/common.css">
        <link rel="stylesheet" href="css/admin.css">
    </head>

    <body>
        <div class="container">
            <div>
                <div class="easyui-panel" style="width:100%; height:auto;" data-options="title:'爸爸说的都队-后台登录'" id="panel">
                    <div>
                        <label>用户名</label>
                        <input type="text" class="easyui-textbox" data-options="required:true" id="username">
                    </div>

                    <div>
                        <label>密 码</label>
                        <input type="password" class="easyui-textbox" data-options="required:true" id="passwd">
                    </div>

                    <div>
                        <a href="#" class="easyui-linkbutton" onclick="login();">确定</a>
                    </div>
                </div>
            </div>

        </div>

        <script src="js/jquery.min.js"></script>
        <script src="js/jquery.easyui.min.js"></script>
        <script src="js/jquery.edatagrid.js"></script>
        <script src="js/jquery.md5.js"></script>
        <script>
                            function login() {
                                var username = $('#username').textbox('getValue');
                                var passwd = $('#passwd').textbox('getValue');
                                if (username == '' || passwd == '') {
                                    $.messager.alert('错误', '用户名或者密码为空');
                                    return;
                                }

                                $.ajax({
                                    url: 'admin-login.php',
                                    method: 'post',
                                    data: {
                                        username: username,
                                        passwd: passwd
                                    },
                                    dataType: 'json',
                                    success: function (data) {
                                        if (data.status != 'ok') {
                                            $.messager.alert('错误', data.message);
                                        } else {
                                            alert('登录成功');
                                        }
                                    },
                                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                                        $.messager.alert(XMLHttpRequest.status + ' ' + textStatus);
                                    }
                                });
                            }
        </script>
    </body>
</html>